import axios from 'axios'

const request = axios.create({
  baseURL: 'http://www.chat.localhost',
  timeout: 5000
})

// 请求
request.interceptors.request.use((config) => {
  return config
})

// 响应
request.interceptors.response.use(
  (res) => {
    if (res.data.status === 200) {
      return res.data.data
    }
  },
  (err) => {
    return Promise.reject(err)
  }
)

export default request
